import axios from "../myaxios";
import qs from "querystring";
/* 获取首页轮播图的数据 */
export const getHomeSwiperList = () => axios.get("home/swiperdata");
// 获取搜索到的数据
export const getHomeSearchGoods= (params) => axios.get("goods/search",{
    params:params
})
//获取到商品详情
export const getSearchGoodsList = (params) => axios.get("goods/detail",{
        params:params
    })
//获取首页分类
export const getHomeCarList=(params)=>axios.get("home/catitems")
//获取首页列表
export const getHomeGoodsList=()=>axios.get('home/goodslist')

//获取登录接口数据
export const getLogin = (userInfoObj) =>
  axios.post("login", qs.stringify(userInfoObj));
//获取注册接口
export const submitRegister = (registerObj) =>
  axios.post("/users/reg", qs.stringify(registerObj));
// 获取验证码
export const getVerigyCode = (mobile) =>
  axios.post("/users/get_reg_code", qs.stringify({ mobile }));
//获取查询购物车数据
export const getCart = () => axios.get("my/cart/all");
// 获取用户信息
export const getUserInfo = () => axios.get('/my/users/userinfo')
//同步购物车数据
export const syncCart = (data) => axios.post("/my/cart/sync",data).catch(err=>console.log(err));
//获取订单
export const getOrder = () => axios.get("my/orders/all");
//添加购物车
export const addCart = (data)=>axios.post("my/cart/add",data);
//创建订单
export const createOrder = (data)=>axios.post("my/orders/create",data).catch(err=>console.log(err));
// 获取商品列表的信息
export const getProductList = (params) => axios.get("goods/search",{
  params:params
}).catch(err => console.log(err))
// 获取商品分类的信息
export const getCategories = (prams) => axios.get("categories").catch(err => console.log(err));